<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body style=" font-family:Verdana, Geneva, sans-serif;">
<table width="1000" border="1" cellspacing="0" cellpadding="10">
  <tr>
   <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="10">
     <tr>
       <th align="left" scope="col">Invoice #:</th>
       <th align="left" scope="col"><span style="color:#F00;"><?php echo $this->invline['INV_NO']?></span> </th>
       <th align="left" scope="col">&nbsp;</th>
       <th align="left" scope="col">Date</th>
       <th align="left" scope="col"><?php echo date("Y.m.d",strtotime($this->invline['DATE']));?> <?php echo $this->invline['TIME']?></th>
       <th align="left" scope="col">Status</th>
       <th align="left" scope="col"><?php
       switch(trim($this->invline['STATUS'])){
		   case(""):{echo "Open";break;}
		   case("A"):{echo "Active";break;}
		   case("C"):{echo "Close";break;}
		   case("V"):{echo "Void";break;}
		   }
	   ?></th>
     </tr>
     <tr>
       <td colspan="2" align="left">&nbsp;</td>
       <td align="left">&nbsp;</td>
       <td align="left"><strong>Remark</strong></td>
       <td align="left"><strong><?php echo $this->invline['REF']?></strong></td>
       <td align="left"><strong>Salesman</strong></td>
       <td align="left"><strong><?php echo $this->invline['SAL_CODE']?></strong></td>
     </tr>
   </table></td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%" border="1" cellspacing="0" cellpadding="10">
      <tr>
        <th bgcolor="#CCCCCC" scope="col">Item Code</th>
        <th bgcolor="#CCCCCC" scope="col">Description</th>
        <th bgcolor="#CCCCCC" scope="col">Qty</th>
        <th bgcolor="#CCCCCC" scope="col">Pirce</th>
        <th bgcolor="#CCCCCC" scope="col">Disc%</th>
        <th bgcolor="#CCCCCC" scope="col">DiscAmt</th>
        <th bgcolor="#CCCCCC" scope="col">Amt</th>
      </tr>
      <?php foreach($this->invProLines as $k => $v){?>
      <tr>
        <td bgcolor="#99FF66"><?php echo $v['SCODE']?></td>
        <td bgcolor="#99FF66"><?php echo Model_System_Downloadhelper::downloadUrl("http://".SERVER_IP_COMM."/products/get-old-apos-product-description/barcode/".$v['SCODE']);?></td>
        <td align="right" bgcolor="#99FF66"><?php echo (int)$v['QTY']?></td>
        <td align="right" bgcolor="#99FF66">$ <?php echo $v['PRICE']?></td>
        <td align="right" bgcolor="#99FF66"><?php echo ($v['ITEM_DISC'] > 0 )?$v['ITEM_DISC']:"";?></td>
        <td align="right" bgcolor="#99FF66"><?php echo ($v['ITEM_DISCAMT'] > 0)?$v['ITEM_DISCAMT']:''; ?></td>
        <td align="right" bgcolor="#99FF66">$ <?php echo $v['AMOUNT']?></td>
      </tr>
      <?php }?>
    </table></td>
  </tr>
  <tr>
    <td style="width:50%">&nbsp;</td>
    <td><table width="100%" border="1" cellspacing="0" cellpadding="10">
      <tr>
        <th bgcolor="#CCCCCC" scope="col">Pay Type</th>
        <th bgcolor="#CCCCCC" scope="col">Amount</th>
      </tr>
      <tr>
        <td><?php echo ($this->invline['PTYPE1'] == " ")?"":$this->payType[$this->invline['PTYPE1']]?></td>
        <td>$ <?php echo $this->invline['PAID1']?></td>
      </tr>
      <tr>
        <td><?php echo ($this->invline['PTYPE2'] == " ")?"":$this->payType[$this->invline['PTYPE2']]?></td>
        <td>$ <?php echo $this->invline['PAID2']?></td>
      </tr>
      <tr>
        <td><?php echo ($this->invline['PTYPE3'] == " ")?"":$this->payType[$this->invline['PTYPE3']]?></td>
        <td>$ <?php echo $this->invline['PAID3']?></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>Total Pcs :<?php echo (int)$this->invline['QTY_TOTAL']?></td>
    <td align="right"><h2>Total Amount: $ <?php echo $this->invline['PAY_TOTAL']?></h2></td>
  </tr>
</table>
</body>
</html>
